<%--
  Created by IntelliJ IDEA.
  User: dzw
  Date: 2017/12/13
  Time: 14:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
  String _id=request.getParameter("_");
  String jsessionid = session.getId();
%>

<div class="panel">
  <div class="panel-heading header">
    <h3 class="panel-title" id="title">权限申请</h3>
  </div>

  <!-- BASIC FORM ELEMENTS -->
  <!--===================================================-->
  <form id="form_modulePower_input" class="form-horizontal">

    <input type="hidden" name="keyId" id="keyId" value="${modulePower.id}"/>

    <div class="form-group">
      <label class="col-md-2 control-label">申请人<i class="fa fa-asterisk txt-color-red"></i></label>
      <div class="col-md-6">
        <input disabled type="text" name="creater" id="creater" class="form-control" value="${modulePower.creater.name}" >
      </div>
    </div>

    <div class="form-group">
      <label class="col-md-2 control-label">申请模块<i class="fa fa-asterisk txt-color-red"></i></label>
      <div class="col-md-6">
        <input disabled type="text" name="module" id="module" class="form-control" value="${modulePower.moduleName}" >
      </div>
    </div>

    <div class="form-group">
      <label class="col-md-2 control-label">申请表单<i class="fa fa-asterisk txt-color-red"></i></label>
      <div class="col-md-6">
        <input disabled type="text" name="entity" id="entity" class="form-control" value="${entityName}" >
      </div>
    </div>


  </form>
  <!--===================================================-->
  <!-- END BASIC FORM ELEMENTS -->

  <div class="panel-footer">
    <a class="btn btn-default" id="apply-re-common" href="javascript:void(0)">
      <i class="fa fa-lg fa-mail-reply"></i> 返回
    </a>
    <c:if test="${modulePower.processState=='Running' && fn:indexOf(editor,user.id)>=0}">
      <a class="btn btn-success" id="left_foot_btn_approve" href="javascript:void(0)">
        <i class="fa fa-upload"></i> 通过
      </a>
      <a class="btn btn-warning" id="left_foot_btn_sendback" href="javascript:void(0)">
        <i class="fa fa-upload"></i> 退回
      </a>
    </c:if>
    <c:if test="${modulePower.processState=='Backed' && modulePower.creater==user}">
      <a class="btn btn-default" id="apply-re-edit" href="javascript:void(0)">
        <i class="fa fa-upload"></i> 编辑
      </a>
    </c:if>
  </div>

</div>

<script>

  $(function(){

  });

  //通过
  $("#left_foot_btn_approve").off("click").on("click",function(){
    __confirm_dialog("权限申请通过","确认要通过此权限申请吗？",function(){
      __form_save("form_modulePower_input","<%=path%>/com/modulePower/approve", function(){
        $("#apply-re-common").trigger("click");
      });
    });
  });

  //退回
  $("#left_foot_btn_sendback").off("click").on("click",function(){
    var vActionUrl="<%=path%>/com/modulePower/back";
    var keyId = $("input#keyId").val();
    var aData={keyId:$("input#keyId").val()};
    __form_back(keyId, vActionUrl, aData);

  });

  //返回视图
  $("#apply-re-common").click(function(){
      returnToHashUrl();
  });

  //编辑
  $("#apply-re-edit").click(function(){
    loadURL('<%=path%>/com/modulePower/input?keyId='+$("#keyId").val(),$('#page-content'))
  });

</script>